﻿// MT422




using Little.Soldier.SWIFT;
using Little.Soldier.SWIFT.Definition;
using System.Collections.Generic;
using System.ComponentModel;

namespace Little.Soldier.SWIFT.Messages.Category4
{
  public class MT422 : SwiftMessage
  {
    private static SwiftMessageDefinition MessageDefinition;
    private static SwiftTagSequenceDefinition U0002;
    private static SwiftTagDefinition U0003;
    private static SwiftTagSubItemDefinition U0004;
    private static SwiftTagDefinition U0005;
    private static SwiftTagSubItemDefinition U0006;
    private static SwiftTagChoiceDefinition U0007;
    private static SwiftTagDefinition U0008;
    private static SwiftTagSubItemDefinition U000E;
    private static SwiftTagSubItemDefinition U000F;
    private static SwiftTagSubItemDefinition U0010;
    private static SwiftTagDefinition U0011;
    private static SwiftTagSubItemDefinition U0012;
    private static SwiftTagSubItemDefinition U0013;
    private static SwiftTagDefinition U0014;
    private static SwiftTagSubItemDefinition U0015;
    private static SwiftTagSubItemDefinition U0016;
    private static SwiftTagSubItemDefinition U0017;
    private static SwiftTagSubItemDefinition U0018;
    private static SwiftTagSubItemDefinition U0019;
    private static SwiftTagDefinition U001A;
    private static SwiftTagDefinition U001B;
    private static SwiftTagDefinition U001C;

    [Description("Sending Banks TRN")]
    public MT422.SequenceClass[] Sequence
    {
      get
      {
        int index = -1;
        List<MT422.SequenceClass> list = new List<MT422.SequenceClass>();
        int count;
        do
        {
          ++index;
          MT422.SequenceClass sequenceClass = new MT422.SequenceClass((SwiftElement) this, index, false);
          count = this.ListTags((SwiftElement) sequenceClass).Count;
          if (count > 0)
            list.Add(sequenceClass);
        }
        while (count > 0);
        return list.ToArray();
      }
    }

    [Description("Sender To Receiver Information")]
    public Tag72 SenderToReceiverInformation_72
    {
      get
      {
        return new Tag72((SwiftElement) this, 0, (SwiftDefinitionElement) MT422.U001A);
      }
    }

    [Description("Sender To Receiver Information")]
    public Tag72 Tag72_SenderToReceiverInformation
    {
      get
      {
        return this.SenderToReceiverInformation_72;
      }
    }

    [Description("Queries")]
    public Tag75 Queries_75
    {
      get
      {
        return new Tag75((SwiftElement) this, 0, (SwiftDefinitionElement) MT422.U001B);
      }
    }

    [Description("Queries")]
    public Tag75 Tag75_Queries
    {
      get
      {
        return this.Queries_75;
      }
    }

    [Description("Answers")]
    public Tag76 Answers_76
    {
      get
      {
        return new Tag76((SwiftElement) this, 0, (SwiftDefinitionElement) MT422.U001C);
      }
    }

    [Description("Answers")]
    public Tag76 Tag76_Answers
    {
      get
      {
        return this.Answers_76;
      }
    }

    public MT422()
      : base(true)
    {
    }

    public MT422(SwiftMessage message)
      : base(message)
    {
    }

    public MT422.SequenceClass AddSequence()
    {
      return new MT422.SequenceClass((SwiftElement) this, this.Sequence.Length, true);
    }

    public void RemoveSequence(MT422.SequenceClass sequence)
    {
      foreach (SwiftTag tag in this.ListTags((SwiftElement) sequence))
        this.RemoveTag(tag);
    }

    internal override SwiftMessageDefinition MsgDefinition()
    {
      return MT422.MessageDefinition;
    }

    protected override void InitSwiftMessageDefinition()
    {
      MT422.MessageDefinition = new SwiftMessageDefinition("MT422", "Advice of Fate and Request for Instructions");
      MT422.U0002 = new SwiftTagSequenceDefinition("Sequence", "Sending Banks TRN");
      MT422.U0002.Multiple = true;
      MT422.U0003 = new SwiftTagDefinition("SendingBanksTRN_20", "Sending Banks TRN");
      MT422.U0003.TagName = ":20:";
      MT422.U0004 = new SwiftTagSubItemDefinition("Reference", "Reference");
      MT422.U0003.Elements.Add((SwiftDefinitionElement) MT422.U0004);
      MT422.U0002.Elements.Add((SwiftDefinitionElement) MT422.U0003);
      MT422.U0005 = new SwiftTagDefinition("RelatedReference_21", "Related Reference");
      MT422.U0005.TagName = ":21:";
      MT422.U0006 = new SwiftTagSubItemDefinition("Reference", "Reference");
      MT422.U0005.Elements.Add((SwiftDefinitionElement) MT422.U0006);
      MT422.U0002.Elements.Add((SwiftDefinitionElement) MT422.U0005);
      MT422.U0007 = new SwiftTagChoiceDefinition("Choice", "");
      MT422.U0007.Mandatory = false;
      MT422.U0007.Multiple = true;
      MT422.U0008 = new SwiftTagDefinition("AmountOfCollection_32A", "Amount of Collection");
      MT422.U0008.TagName = ":32A:";
      MT422.U000E = new SwiftTagSubItemDefinition("Date", "Date");
      MT422.U0008.Elements.Add((SwiftDefinitionElement) MT422.U000E);
      MT422.U000F = new SwiftTagSubItemDefinition("Currency", "Currency");
      MT422.U0008.Elements.Add((SwiftDefinitionElement) MT422.U000F);
      MT422.U0010 = new SwiftTagSubItemDefinition("Amount", "Amount");
      MT422.U0008.Elements.Add((SwiftDefinitionElement) MT422.U0010);
      MT422.U0007.Elements.Add((SwiftDefinitionElement) MT422.U0008);
      MT422.U0011 = new SwiftTagDefinition("AmountOfCollection_32B", "Amount of Collection");
      MT422.U0011.TagName = ":32B:";
      MT422.U0012 = new SwiftTagSubItemDefinition("Currency", "Currency");
      MT422.U0011.Elements.Add((SwiftDefinitionElement) MT422.U0012);
      MT422.U0013 = new SwiftTagSubItemDefinition("Amount", "Amount");
      MT422.U0011.Elements.Add((SwiftDefinitionElement) MT422.U0013);
      MT422.U0007.Elements.Add((SwiftDefinitionElement) MT422.U0011);
      MT422.U0014 = new SwiftTagDefinition("AmountOfCollection_32K", "Amount of Collection");
      MT422.U0014.TagName = ":32K:";
      MT422.U0015 = new SwiftTagSubItemDefinition("DayMonth", "Day Or Month");
      MT422.U0014.Elements.Add((SwiftDefinitionElement) MT422.U0015);
      MT422.U0016 = new SwiftTagSubItemDefinition("NumberOfDaysMonths", "Number Of Days Months");
      MT422.U0014.Elements.Add((SwiftDefinitionElement) MT422.U0016);
      MT422.U0017 = new SwiftTagSubItemDefinition("Code", "Code");
      MT422.U0014.Elements.Add((SwiftDefinitionElement) MT422.U0017);
      MT422.U0018 = new SwiftTagSubItemDefinition("Currency", "Currency");
      MT422.U0014.Elements.Add((SwiftDefinitionElement) MT422.U0018);
      MT422.U0019 = new SwiftTagSubItemDefinition("Amount", "Amount");
      MT422.U0014.Elements.Add((SwiftDefinitionElement) MT422.U0019);
      MT422.U0007.Elements.Add((SwiftDefinitionElement) MT422.U0014);
      MT422.U0002.Elements.Add((SwiftDefinitionElement) MT422.U0007);
      MT422.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT422.U0002);
      MT422.U001A = new SwiftTagDefinition("SenderToReceiverInformation_72", "Sender To Receiver Information");
      MT422.U001A.TagName = ":72:";
      MT422.U001A.Mandatory = false;
      MT422.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT422.U001A);
      MT422.U001B = new SwiftTagDefinition("Queries_75", "Queries");
      MT422.U001B.TagName = ":75:";
      MT422.U001B.Mandatory = false;
      MT422.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT422.U001B);
      MT422.U001C = new SwiftTagDefinition("Answers_76", "Answers");
      MT422.U001C.TagName = ":76:";
      MT422.U001C.Mandatory = false;
      MT422.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT422.U001C);
    }

    public class SequenceClass : SwiftTagSequence
    {
      internal override SwiftDefinitionElement Definition
      {
        get
        {
          return (SwiftDefinitionElement) MT422.U0002;
        }
      }

      [Description("Sending Banks TRN")]
      public Tag20 SendingBanksTRN_20
      {
        get
        {
          return new Tag20((SwiftElement) this, 0, (SwiftDefinitionElement) MT422.U0003);
        }
      }

      [Description("Sending Banks TRN")]
      public Tag20 Tag20_SendingBanksTRN
      {
        get
        {
          return this.SendingBanksTRN_20;
        }
      }

      [Description("Related Reference")]
      public Tag21 RelatedReference_21
      {
        get
        {
          return new Tag21((SwiftElement) this, 0, (SwiftDefinitionElement) MT422.U0005);
        }
      }

      [Description("Related Reference")]
      public Tag21 Tag21_RelatedReference
      {
        get
        {
          return this.RelatedReference_21;
        }
      }

      [Description("Amount of Collection")]
      public Tag32A AmountOfCollection_32A
      {
        get
        {
          return new Tag32A((SwiftElement) this, 0, (SwiftDefinitionElement) MT422.U0008);
        }
      }

      [Description("Amount of Collection")]
      public Tag32A Tag32A_AmountOfCollection
      {
        get
        {
          return this.AmountOfCollection_32A;
        }
      }

      [Description("Amount of Collection")]
      public Tag32B AmountOfCollection_32B
      {
        get
        {
          return new Tag32B((SwiftElement) this, 0, (SwiftDefinitionElement) MT422.U0011);
        }
      }

      [Description("Amount of Collection")]
      public Tag32B Tag32B_AmountOfCollection
      {
        get
        {
          return this.AmountOfCollection_32B;
        }
      }

      [Description("Amount of Collection")]
      public Tag32K AmountOfCollection_32K
      {
        get
        {
          return new Tag32K((SwiftElement) this, 0, (SwiftDefinitionElement) MT422.U0014);
        }
      }

      [Description("Amount of Collection")]
      public Tag32K Tag32K_AmountOfCollection
      {
        get
        {
          return this.AmountOfCollection_32K;
        }
      }

      internal SequenceClass(SwiftElement parent, int index, bool createTags)
        : base(parent, index, createTags)
      {
      }
    }
  }
}
